package cn.itcast.feign.client.fallback;

import cn.itcast.feign.client.UserClient;
import cn.itcast.feign.pojo.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @author llhuang10
 * @date 2021/9/15 19:47
 */
@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {


    @Override
    public UserClient create(Throwable throwable) {
        log.error("查询用户异常", throwable);
        return id -> new User();
    }
}
